<?php

/**
 * @application Automatical Judging System
 * @author deltamaster
 * @copyright Softrank Research Center
 * @version 2.0.0.0
 */

define('IN_SHUJUDGE', 1);

if (get_magic_quotes_gpc())
{
	$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
	while (list($key, $val) = each($process))
	{
		foreach ($val as $k => $v)
		{
			unset($process[$key][$k]);
			if (is_array($v))
			{
				$process[$key][stripslashes($k)] = $v;
				$process[] = &$process[$key][stripslashes($k)];
			} else
			{
				$process[$key][stripslashes($k)] = stripslashes($v);
			}
		}
	}
	unset($process);
}

$code_stime = microtime();
session_start();

$uid = (isset($_SESSION['uid']) ? $_SESSION['uid'] : 0);
$username = (isset($_SESSION['username']) ? $_SESSION['username'] : "");
$nickname = (isset($_SESSION['nickname']) ? $_SESSION['nickname'] : "");
date_default_timezone_set("Asia/Shanghai");
$timestamp = $_SERVER['REQUEST_TIME'];

require_once "sc.lang.php";
require_once "global.func.php";
require_once "judge.func.php";
require_once "db.class.php";
require_once "contest.class.php";
require_once "verify.func.php";

if (empty($_POST) && array_key_exists('last_run_time', $_SESSION) && array_key_exists('last_request_url', $_SESSION))
{
	if (($_SERVER['REQUEST_TIME'] - $_SESSION['last_run_time'] < 1) && ($_SESSION['last_request_url'] == $_SERVER['REQUEST_URI']))
	{
		showmessage($lang['prevent_refresh'], $_SERVER['REQUEST_URI']);
		exit();
		//exit($lang['prevent_refresh']);
	}
}
$_SESSION['last_run_time'] = $_SERVER['REQUEST_TIME'];
$_SESSION['last_request_url'] = $_SERVER['REQUEST_URI'];

$action = (array_key_exists('action', $_GET) ? $_GET['action'] : "");

date_default_timezone_set('Asia/Shanghai');

$db = new dbstuff;
$tablepre = $db->tablepre;

$sys_uid = (array_key_exists('uid', $_SESSION) ? $_SESSION['uid'] : 0);
$sys_username = (array_key_exists('username', $_SESSION) ? $_SESSION['username'] :
    "");
$sys_nickname = (array_key_exists('nickname', $_SESSION) ? $_SESSION['nickname'] :
    "");
$adminid = (array_key_exists('adminid', $_SESSION) ? $_SESSION['adminid'] : 0);
$adminlevel = array(0 => $lang['usergroup']['guest'], 1 => $lang['usergroup']['admin'], 2 => $lang['usergroup']['moderator'], 99 =>$lang['usergroup']['user']);

define("FORMHASH", formhash());

require_once "contest.inc.php";
require_once "menu.inc.php";

?>
